package com.jinxi.controller;
import com.jinxi.domain.Demo;
import com.jinxi.service.DemoService;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
@RestController
@RequestMapping("/demo")
public class DemoController {
    /*
    @Value("${Demo.hello:Demo}")
    private String DemoHello;
    @GetMapping ("/hello")
    public String hello(){return "hello world"+DemoHello;}
    @PostMapping("/hello/post")
    public String helloPost(String name) {return "hello world! post," + name;}
     */
    @Resource
    private DemoService DemoService;

    @GetMapping("/list")
    public List<Demo> list(){
        return DemoService.list();
    }
}
